package com.huawei.appmarket.service.thirdupdate;

import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import com.huawei.appmarket.framework.activity.SecureActivity;
import com.huawei.appmarket.service.thirdupdate.ThirdUpdateActivityProtocol.Request;
import com.huawei.updatesdk.service.otaupdate.UpdateKey;
import o.Logger;
import o.eju;
import o.ejv;
import o.ekd;
import o.ewm.h;
import o.ewm.j;
import o.FragmentTransaction;

public class ThirdUpdateActivity extends SecureActivity<ThirdUpdateActivityProtocol> implements ekd {
    public void onCreate(Bundle bundle) {
        Logger.ˎ("ThirdUpdateActivity", "ThirdUpdateActivity onCreate");
        super.onCreate(bundle);
        getWindow().requestFeature(1);
        setContentView(h.ᐝ);
        ejv o_ejv = new ejv();
        ThirdUpdateActivityProtocol thirdUpdateActivityProtocol = (ThirdUpdateActivityProtocol) ʾ();
        if (thirdUpdateActivityProtocol == null) {
            setResult(1, ˎ(-99));
            finish();
            return;
        }
        Request ˎ = thirdUpdateActivityProtocol.ˎ();
        if (ˎ == null) {
            setResult(1, ˎ(-99));
            finish();
            return;
        }
        String ˋ = ˎ.ˋ();
        o_ejv.ˏ(ˎ.ॱ());
        o_ejv.ॱ(ˎ.ˎ());
        if (ˊ(o_ejv, ˎ, ˋ)) {
            setResult(1, ˎ(-99));
            finish();
            return;
        }
        o_ejv.ˋ(ˎ.ˊ());
        o_ejv.ˎ(ˎ.ॱॱ());
        o_ejv.ˎ(ˎ.ʽ());
        o_ejv.ˊ(ˎ.ʻ());
        o_ejv.ˋ(ˎ.ʼ());
        if (ˎ.ᐝ()) {
            new eju(this, o_ejv, this).execute(new Void[0]);
        } else {
            ॱ(ˋ, ˎ.ˏ());
        }
    }

    private void ॱ(String str, boolean z) {
        Fragment ॱ = UpdateSdkFragment.ॱ(str, z);
        FragmentTransaction ˊ = ˏॱ().ˊ();
        ˊ.ˏ(j.ᐨ, ॱ);
        ˊ.ˋ();
    }

    private boolean ˊ(ejv o_ejv, Request request, String str) {
        return (!request.ᐝ() && str == null) || (request.ᐝ() && o_ejv.ˊ() == null && o_ejv.ॱ() == null);
    }

    public void onPause() {
        super.onPause();
    }

    public void ˎ() {
        Logger.ˎ("ThirdUpdateActivity", "connectError");
        setResult(2, ˎ(-99));
        finish();
    }

    public void ˊ() {
    }

    public void ˎ(boolean z) {
        Logger.ˎ("ThirdUpdateActivity", "user cancel Upgrade");
        Intent ˎ = ˎ(-99);
        ˎ.putExtra(UpdateKey.MUST_UPDATE, z);
        setResult(4, ˎ);
        finish();
    }

    public void ˏ() {
        Logger.ˎ("ThirdUpdateActivity", "noUpgradeInfo");
        setResult(3, ˎ(-99));
        finish();
    }

    public void ap_() {
        Logger.ˎ("ThirdUpdateActivity", "updateSucceed");
        setResult(0, ˎ(1));
        finish();
    }

    public void ॱ(String str, int i) {
        setResult(5, ˎ(i));
        finish();
    }

    private Intent ˎ(int i) {
        Intent intent = new Intent();
        intent.putExtra("installResultCode", i);
        return intent;
    }

    public void ˋ() {
        setResult(9, ˎ(-99));
        finish();
    }
}
